package com.daxue.lcm.api.grpc.properties;

import com.daxue.lcm.api.grpc.config.GrpcServiceInfo;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.HashMap;
import java.util.Map;

/**
 * @author daxue0929
 * @date 2022/9/28
 */


@ConfigurationProperties(
    prefix = "grpc"
)
public class GrpcServiceProperties {

    public static final String SERVICE_PREFIX = "grpc.service.";
    public static final String DISABLE_SERVICE = "false";
    public static final String ENABLE_SERVICE = "true";
    public static final String ENABLED = "enabled";
    public static final String TARGET = "target";
    public static final String HOST = "host";
    public static final String PORT = "port";
    private Map<String, GrpcServiceInfo> service = new HashMap(8);

    public GrpcServiceProperties() {
    }

    public Map<String, GrpcServiceInfo> getService() {
        return this.service;
    }

    public void setService(final Map<String, GrpcServiceInfo> service) {
        this.service = service;
    }

    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof GrpcServiceProperties)) {
            return false;
        } else {
            GrpcServiceProperties other = (GrpcServiceProperties)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                Object this$service = this.getService();
                Object other$service = other.getService();
                if (this$service == null) {
                    if (other$service != null) {
                        return false;
                    }
                } else if (!this$service.equals(other$service)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof GrpcServiceProperties;
    }

    public int hashCode() {
        boolean PRIME = true;
        int result = 1;
        Object $service = this.getService();
        result = result * 59 + ($service == null ? 43 : $service.hashCode());
        return result;
    }

    public String toString() {
        return "GrpcServiceProperties(service=" + this.getService() + ")";
    }
}
